//Retour sur l'unité maitre

_newrole=objnull;

if (count _this >1) then {_newrole = _this select 1;}
else {_newrole = _this select 0;};
              //Verifie si l'unité est en véhicule
             
              
              _pos="";
              _inVehicle="FALSE";
              _itsVehicle =  vehicle _newrole;
              _owner = objNull;
          
  /*          
              if ( player != vehicle player ) then
              {
              _inVehicle="TRUE";
              if (_newrole == driver _vehicle) then {_pos = "driver" ;_newrole groupChat "driver";};
              if (_newrole == gunner _vehicle) then {_pos = "gunner" ;_newrole groupChat "gunner";};
              if (_newrole == crew _vehicle) then {_pos = "crew";_newrole groupChat "crew";};
              if (_newrole == commander _vehicle) then {_pos = "commander";_newrole groupChat "commander";};
              };
             

              
if   ( _inVehicle == "TRUE" ) then {moveOut player;_newrole groupChat "getout"};   
*/                   
_newrole removeAction (_newrole getVariable "TKCACTION");
if (_itsVehicle != _newrole) then 
{
_itsVehicle removeAction (_itsVehicle getVariable "TKCACTIONVEH");
_itsVehicle setVariable ["GMABLE","TRUE",TRUE];
};
_newrole setVariable ["GMABLE","TRUE",TRUE];
_owner = _newrole getVariable "GMCONTROL";
//If dead lets wait a bit to understand the npc is dead
if (!alive _newrole) then {sleep 3;};
selectPlayer _owner;

removeSwitchableUnit _newrole;

//on remelt le GM dans son groupe de départ (hum... west toujours ?)
_sidegrp = creategroup vts_side;
[_owner] join _sidegrp;
[user1] join _sidegrp;

/*
    
      	      if (_pos == "driver") then {_newrole moveInDriver _vehicle;};
      	      if (_pos == "gunner") then {_newrole moveInGunner _vehicle;};
      	      if (_pos == "crew") then {_newrole moveInCargo _vehicle;};
      	      if (_pos == "commander") then {_newrole moveInCommander _vehicle;};
      	      
      	      
_newrole groupChat "getout"};  
*/
_code={
					user1 allowDamage true;
					user1 setCaptive false;
					};
					[_code] execVM "scripts\VTS_Functions\runcodeonallclients.sqf";
if (player==user1) then {ctrlShow [19000,false];};
